#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <vector>
#include <string>
using namespace std;
const int N = 200005;
priority_queue<int, vector<int>, greater<int> > q;
int n;
void d_x(string &s) {
    for (int i = 0; i < s.size(); ++ i) {
        if (s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';
    }
}
unordered_map<string, pair<int, string> > M;
int id = 1;
typedef pair<int, int> PII;
typedef pair<int, PII> PI;
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cin >> n;
    vector<PI> v;
    for (int i = 1; i <= n; ++ i) {
        int a, b;
        cin >> a >> b;
        v.push_back({a * b, {a, n - i}});
    }
    sort(v.begin(), v.end(), [](PI a, PI b){ return a > b;});
    for (auto i : v) {
        cout << n - i.second.second << ' ';
    }
    cout << endl;
    return 0;
}